package cn.lf.android.lawfirm.view;


import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathEffect;
import android.util.AttributeSet;
import android.view.View;

import cn.lf.android.lawfirm.R;

public class DashedLine extends View {
	
	
	private int lineColor;
	
	public DashedLine(Context context, AttributeSet attrs) {
		super(context, attrs);
		TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DashedLine);
		lineColor=a.getColor(R.styleable.DashedLine_line_color,0xffff6468);
		a.recycle();
	}
	
	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		Paint paint = new Paint();
		paint.setStyle(Paint.Style.STROKE);
		paint.setColor(lineColor);
		Path path = new Path();
		path.moveTo(0, 1);
		path.lineTo(3000, 1);
		PathEffect effects = new DashPathEffect(new float[] { 8, 8, 8, 8 }, 1);
		paint.setPathEffect(effects);
		canvas.drawPath(path, paint);
	}

}
